]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
unlockDialog: Support clock/prompt switching via scrolling
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 11 Feb 2020 16:46:11 +0000 (17:46 +0100)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Thu, 13 Feb 2020 15:01:25 +0000 (15:01 +0000)
SwipeTracker "only" handles touch gestures and smooth scrolling.
Scrolling still makes sense for regular mice as well though, so
add handling for that as well.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/972

js/ui/unlockDialog.js

index 1816689a35e187b6a8ed0777a28c2a28a40695e7..d535a721b68730c74ab598d786b0391725614313 100644 (file)
@@ -443,6 +443,18 @@ var UnlockDialog = GObject.registerClass({
         this._swipeTracker.connect('update', this._swipeUpdate.bind(this));
         this._swipeTracker.connect('end', this._swipeEnd.bind(this));
 
+        this.connect('scroll-event', (o, event) => {
+            if (this._swipeTracker.canHandleScrollEvent(event))
+                return Clutter.EVENT_PROPAGATE;
+
+            let direction = event.get_scroll_direction();
+            if (direction === Clutter.ScrollDirection.UP)
+                this._showClock();
+            else if (direction === Clutter.ScrollDirection.DOWN)
+                this._showPrompt();
+            return Clutter.EVENT_STOP;
+        });
+
         this._activePage = null;
 
         let tapAction = new Clutter.TapAction();